<?php

$mysqli = @new mysqli("localhost", "root", "root","school");

if($mysqli->connect_errno>0){
    exit("数据库链接失败,失败的原因：代码：".$mysqli->connect_errno.'错误信息:'.$mysqli->connect_error);
}


$mysqli->query("set names utf8");

$sql = "update stu set age=age+5 where cid=1";

$sql = "select * from stu where sex='男'";

$res = $mysqli->query($sql);

if(!$res){
    exit("执行失败,失败的原因：代码：".$mysqli->errno.'错误信息:'.$mysqli->error);
}

$temp = [];

while ($row=$res->fetch_assoc()) {
    $temp[] = $row;
}

var_dump($temp);

$mysqli->close();
// var_dump($mysqli);

// $sql = "select * from stu where sex='男'";



